package win.ganbo.ssm.listener;

import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import win.ganbo.ssm.event.UserEventDemoTest;

/**
 *
 * @author ganbo E-mail:bo.gan@56qq.com
 * @since 2017-11-10 20:18
 */
@Service
public class UserEventDemoTestListener {

    @Async //异步事件
    @EventListener  //注册为一个监听器
    public void onApplicationEvent(UserEventDemoTest userEventDemoTest) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("时间监听器监听到消息=====>" + userEventDemoTest.getSource());
    }
}
